home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr46 / strx221.zip / DYNSTREA.H < prev    next >
Text File  |  1993-03-08  |  1KB  |  58 lines

  1. //
  2. // dynstream.h : dynstream class interface
  3. // Author  : Roy S. Woll
  4. //
  5. // Copyright (c) 1993 by Roy S. Woll
  6. // You may distribute this source freely as long as you leave all files
  7. // in their original form, including the copyright notice as is.
  8. //
  9. //
  10. // Version 2.00     11/30/92
  11. //    Override member function streambuf::sync()   Roy S. Woll
  12. //
  13. // Version 1.00     10/20/92
  14. //
  15. //
  16. #ifndef _DYNSTREAM_H
  17. #define _DYNSTREAM_H
  18.  
  19. #include <iostream.h>
  20.  
  21. #include "str.h"
  22.  
  23.  
  24. class dynstreambuf : public streambuf{
  25.    str* strPtr;
  26.  
  27. protected:
  28.    virtual int overflow(int = EOF);
  29.    virtual streampos seekoff(streamoff offset, ios::seek_dir dir, int);
  30.    virtual int sync();
  31.  
  32.    char * getNewBuffer(int newbufsize);
  33.  
  34. public:
  35.    dynstreambuf(str *);
  36.  
  37.    void set_len(int len);
  38.    void set_str(str *);
  39.    void setNewBuffer(char * buf, int newbufsize, int curlength=0);
  40. };
  41.  
  42. class dynstreambase : public virtual ios{
  43. protected:
  44.    dynstreambuf mystreambuf;
  45. public:
  46.    dynstreambase(str * AstrPtr): mystreambuf(AstrPtr){};
  47.    dynstreambuf * rdbuf(){return &mystreambuf; };
  48.  
  49. };
  50.  
  51. class dynstream: public dynstreambase, public ostream{
  52. public:
  53.    dynstream(str *);
  54.    ~dynstream(void);
  55. };
  56.  
  57. #endif
  58.